package phase01.module2.code.question2;

import phase01.module2.code.question2.exceptions.InvalidLocationException;

public class Test {
    public static void main(String[] args) throws InvalidLocationException {
        Board board = new Board();
        Coordinate coordinate = new Coordinate();
        Player a = new Player("alex", 30, 12, new Pawn(Colors.BLACK, "x"), board);
        Player b = new Player("java", 100, 50, new Pawn(Colors.WHITE, "o"), board);
        boolean won = false;
        int[][] aC = {{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}};
        int[][] bC = {{1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}};
        board.draw();
        for (int i = 0; i < aC.length; i++) {
            coordinate.setX(aC[i][0]);
            coordinate.setY(aC[i][1]);
            won = a.play(coordinate);
            board.draw();
            if (won) {
                System.out.println("A win");
                break;
            }
            coordinate.setX(bC[i][0]);
            coordinate.setY(bC[i][1]);
            won = b.play(coordinate);
            board.draw();
            if (won) {
                System.out.println("B win!");
                break;
            }
        }
    }
}
